package com.iims.project.vo.query;

import com.iims.common.utils.SecurityUtils;
import com.iims.common.vo.GroupSearchBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 范围（全部、我的、本部门的）、执行状态、项目类别、时间；
 *
 * @author fanpei
 * @date 2021/7/15 13:52
 */
@ApiModel("项目分组搜索参数")
@Data
public class GroupProjectSearchQuery extends GroupSearchBase {

    @ApiModelProperty(value = "数据范围搜索:显示和值来源于字典数据business_common_searchDeptScopeData", required = true)
    private int scopeValue = -1;

    @ApiModelProperty(value = "项目属性搜索:business_project_searchProAttr", required = true)
    private int proAttr = -1;

    @ApiModelProperty(value = "项目类别搜索:business_project_searchProType", required = true)
    private int proType = -1;

    @ApiModelProperty(value = "项目状态搜索:business_project_searchStatus", required = true)
    private int proStatus = -1;


    @Override
    public void initCurrentUser() {
        /**
         * 设置用户user_code
         */
        if (scopeValue == 0) {
            currentUser = SecurityUtils.getLoginUser().getUser().getUser_code();
        }

        if (scopeValue == 1) {
            currentDept = SecurityUtils.getLoginUser().getUser().getDeptId();
        }
    }
}
